package cn.qiyu5522.tk_ems.config;

import cn.qiyu5522.tk_ems.injector.EasySqlInjector;
import com.alibaba.fastjson2.support.config.FastJsonConfig;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ProjectName: tk_ems
 * @Package: cn.qiyu5522.tk_ems.config
 * @ClassName: MybatisPlusConfigg
 * @Author: [Lucky Star]
 * @Date: 2023/1/27 21:42
 * @Version: V1.0
 **/

@Configuration
@MapperScan("cn.qiyu5522.tk_ems.mapper")
public class MybatisPlusConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));  //分页
        return interceptor;
    }

    /*
     * @description: 批量插入所需配置，自定义Mapper接口继承EasyBasemapper可实现批量插入
     * @author: TangQi
     * @date: 2023/1/7 16:36
     * @return: com.tps.tenant.injector.EasySqlInjector
     **/
    @Bean
    public EasySqlInjector easySqlInjector() {
        return new EasySqlInjector();
    }

}
